package com.ruoyi.web.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysWhitePaperRequire;
import com.ruoyi.system.service.ISysWhitePaperRequireService;

/**
 * 白皮书编写要求Controller
 *
 * @author ruoyi
 * @date 2025-10-20
 */
@RestController
@RequestMapping("/system/require")
public class SysWhitePaperRequireController extends BaseController
{
    @Autowired
    private ISysWhitePaperRequireService sysWhitePaperRequireService;

    /**
     * 新增白皮书编写要求
     */
    @Log(title = "白皮书编写要求", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysWhitePaperRequire sysWhitePaperRequire)
    {
        sysWhitePaperRequireService.insertSysWhitePaperRequire(sysWhitePaperRequire);

        return success();
    }

    /**
     * 根据项目ID获取白皮书编写要求信息
     */
    @GetMapping( "/getInfoByProjectId")
    public AjaxResult getInfoByProjectId(Long projectId)
    {
        return success(sysWhitePaperRequireService.selectSysWhitePaperRequireByProjectId(projectId));
    }

}
